Representing Objects in a Logic Programming Language With Scoping Constructs
نویسندگان
چکیده
We present a logic programming language that uses implications and universal quantifiers in goals and in the bodies of clauses to provide a simple scoping mechanism for program clauses and constants. Within this language it is possible to define a simple notion of parametric module and local constant. Given this ability to structure programs, we explore how object-oriented programming, where objects are viewed as abstractions with behaviors, state, and inheritance, might be accommodated. To capture the notion of mutable state, we depart from the pure logic setting by adding a declaration that certain local predicates are deterministic (they succeed at most once). This declaration, along with a goal-continuation passing style of programming is adequate to model the state of objects. We also examine a few aspects of how having objects embedded in logic programming can be used to enrich the notion of object: for example, objects may be partial (that is, may contain free variables) and non-deterministic, and it is possible not only to search for objects with certain properties but also to do hypothetical reasoning about them. Comments University of Pennsylvania Department of Computer and Information Science Technical Report No. MSCIS-90-31. This technical report is available at ScholarlyCommons: http://repository.upenn.edu/cis_reports/545 Representing Object In A Logic Programming Language With Scoping Constructs MS-CIS-90-31 LINC LAB 172 Joshua S. Hodas Dale Miller Department of Computer and Information Science School of Engineering and Applied Science University of Pennsylvania Philadelphia, PA 19104
منابع مشابه
Representing Objects in a Logic Programming Langueage with Scoping Constructs
We present a logic programming language that uses implications and universal quantifiers in goals and in the bodies of clauses to provide a simple scoping mechanism for program clauses and constants. Within this language it is possible to define a simple notion of parametric module and local constant. Given this ability to structure programs, we explore how object-oriented programming, where ob...
متن کاملFluents: A Refactoring of Prolog for Uniform Reflection an Interoperation with External Objects
On top of a simple kernel (Horn Clause Interpreters with LD-resolution) we introduce Fluents, high level stateful objects which empower and simplify the architecture of logic programming languages through reflection of the underlying interpreter, while providing uniform interoperation patterns with object oriented and procedural languages. We design a Fluent class hierarchy which includes first...
متن کاملScoping Constructs in Logic Programming: Implementation Problems and Their Solution Scoping Constructs in Logic Programming: Implementation Problems and Their Solution
The inclusion of universal quanti cation and a form of implication in goals in logic programming is considered. These additions provide a logical basis for scoping but they also raise new implementation problems. When universal and existential quanti ers are permitted to appear in mixed order in goals, the devices of logic variables and uni cation that are employed in solving existential goals ...
متن کاملScoping Constructs in Logic Programming : Implementation Problems and their
This paper examines the implementation issues arising from introducing universally quantiied goals and some forms of implication goals in a logic programming language. While these constructs are useful in providing a logical approach to lexical scoping, they raise new implementation problems. Since universal and existential quantiiers may appear in mixed order in goals, the uniication operation...
متن کاملScoping Constructs for Program Generators
Program generation is the process of generating code in a high-level language (e.g., C, C++, Java) to implement an abstract specification of a program. Generated programs are created by synthesizing and composing code fragments. Binding identifiers in generated code with their correct variable declarations has been the focus of a lot of research work in the context of macro-expansion (e.g., hyg...
متن کامل